var resObject;
var mode; //0:ActiveX1 (IE7) / 1:ActiveX2 / 2:XMLHttpRequest (Firefox)

image1 = new Image();
image1.src = "./images/colorchooser_bg1.png";
image1b = new Image();
image1b.src = "./images/colorchooser_bg1b.png";
image2 = new Image();
image2.src = "./images/colorchooser_bg2.png";
image2b = new Image();
image2b.src = "./images/colorchooser_bg2b.png";

function init()
{
	try
	{
		resObject = new ActiveXObject("Microsoft.XMLHTTP");
		mode = 0;
	}
	catch(Error)
	{
		try
		{
			resObject = new ActiveXObject("MSXML2.XMLHTTP");
			mode = 1;
		}
		catch(Error)
		{
			try
			{
				resObject = new XMLHttpRequest();
				mode = 2;
			}
			catch(Error)
			{
				alert("Could not initialise the XMLHttpRequest-Object.");
			}
		}
	}
}

function insertTable()
{

	if(mode==2)
	{
		rowsVal = this.document.getElementById('rows').value;
		colsVal = this.document.getElementById('cols').value;
		borderVal = this.document.getElementById('border').value;
		cellpaddingVal = this.document.getElementById('cellpadding').value;
		cellspacingVal = this.document.getElementById('cellspacing').value;
	}
	else
	{
		rowsVal = rows.value;
		colsVal = cols.value;
		borderVal = border.value;
		cellpaddingVal = cellpadding.value
		cellspacingVal = cellspacing.value;
	}

	close();
	opener.insertTable(rowsVal, colsVal, borderVal, cellpaddingVal, cellspacingVal);
}

